package com.bishe.demo.modules.hotel.hotelPolicy.dao;

import com.bishe.demo.modules.hotel.hotelPolicy.entity.AddBed;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface AddBedDao {
    @Insert("insert into hotel_add_bed values(null,#{allowAddBed},#{bedNum},#{bedCost},#{breakfast})")
    @Options(useGeneratedKeys = true, keyProperty = "addBedId", keyColumn = "add_bed_id")
    void insertAddBed(AddBed addBed);

    @Select("select * from hotel_add_bed hab left join hotel_policy_add_bed hpab on hpab.add_bed_id=hab.add_bed_id where hpab.policy_id=#{policyId}")
    AddBed getAddBedByPolicyId(int policyId);

    @Delete("delete from hotel_add_bed where add_bed_id=#{addBedId}")
    void deleteByAddBedId(int addBedId);
}
